﻿using System;
namespace Producers.Rr.Xtee.Riik.Ee.Producer.Rr {
    
    
    public class DokumendiTyyp : global::Xtee.Core.Schema.XsdString {
        
        public const string EVPASS = "D1";
        
        public const string ISIKUTUNNISTUSIDKAART = "D67";
        
        public const string VÄLISMAALASEPASSEESTI = "D50";
        
        public const string VÄLISRIIGIPASS = "D27";
        
        public const string ELAMISLUBA = "L9";
        
        public DokumendiTyyp(string value) : 
                base(value) {
            this.Validate();
            string annot = null;
            if (Value == "D1") {
                annot = "EV pass";
            }
            if (Value == "D67") {
                annot = "Isikutunnistus (ID-kaart)";
            }
            if (Value == "D50") {
                annot = "Välismaalase pass (Eesti)";
            }
            if (Value == "D27") {
                annot = "Välisriigi pass";
            }
            if (Value == "L9") {
                annot = "Elamisluba";
            }
            if (annot!=null) {
                this._annotation = annot;
            }
            else {
                throw new global::Xtee.Core.Types.XteeSimpleTypeValidationException(string.Format("Enumeration on [{0}] does not allow value : [{1}] ", this.GetType().Name,Value.ToString()));;
            }
        }
        
        public DokumendiTyyp() : 
                base(string.Empty) {
        }
        
        public static bool TryParse(string value, out global::Producers.Rr.Xtee.Riik.Ee.Producer.Rr.DokumendiTyyp result) {
            try {
                result = new global::Producers.Rr.Xtee.Riik.Ee.Producer.Rr.DokumendiTyyp(value);
                return true;
            }
            catch (System.Exception ) {
                result = null;
                return false;
            }
        }
        
        public static implicit operator String (DokumendiTyyp value) {
            return value.Value;
        }
        
        public static implicit operator DokumendiTyyp (string value) {
            if (value==null) {
                return null;
            }
            return new DokumendiTyyp(value);
        }
    }
}
